<?php

declare(strict_types=1);
/**
 * This file is part of MoChat.
 * @link     https://mo.chat
 * @document https://mochat.wiki
 * @contact  group@mo.chat
 * @license  https://github.com/mochat-cloud/mochat/blob/master/LICENSE
 */

namespace MoChat\App\Client\Logic\Detail;

use Hyperf\DbConnection\Db;

/**
 * 经营范围逻辑.
 *
 */
class BusinessScopeLogic
{

    /**
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function handle(array $params): array
    {
        //查询用户内码
        $uniqueId = Db::connection('b2b')->table('user')->where('id', $params['clientId'])->value('unique_id');
        //查经营范围
        $res = Db::connection('b2b')->table('business_scope')->where('unique_id', $uniqueId)->pluck('type')->toArray();
        return $res;
    }
}
